package com.farm.decorator;

import com.farm.AgriculturalMachine;


//土壤分析装饰器
public class SoilAnalysisDecorator extends MachineDecorator {
    public SoilAnalysisDecorator(AgriculturalMachine decoratedMachine) {
        super(decoratedMachine);
    }


    @Override
    public void operate(String machineName) {
        super.operate(machineName);
        analyzeSoil(machineName);
    }

    @Override
    public void displayStatus(String machineName) {

    }

    @Override
    public String getDescription() {
        return super.getDescription() + ", 带土壤分析";
    }

    private void analyzeSoil(String  machineName) {
        System.out.println(machineName + ": " + "分析土壤: 湿度 " + (int) (Math.random() * 100) + "%, pH值 " + (5 + Math.random() * 4));
    }
}
